<?php
class Attached extends La_Controller {
	/**
	 * 招聘信息
	 */
	function recruit() {
		$this->load->view('/attached/recruit');
	}
	
	/**
	 * 关于我们
	 */
	function about_us() {
		$this->load->view('/attached/about_us');
	}
	
	/**
	 * 联系我们
	 */
	function contact() {
		$this->load->view('/attached/contact');
	}
	
	/**
	 * 投诉与建议
	 */
	function feedback() {
		if ($_SERVER['REQUEST_METHOD'] == 'POST') {
			$title = $this->input->post('title');
			$content = $this->input->post('content');
			$data = array('title' => $title, 'content' => $content);
			$this->load->model("Suggest_model");
			$this->load->library('form_validation');
			$data['created'] = date("Y-m-d H:i:s");
			$this->form_validation->set_error_delimiters('<div class="error">', '</div>');
			
			$this->form_validation->set_rules('title', '事项标题', 'required');
			$this->form_validation->set_rules('content', '内容', 'required');
			if ($this->form_validation->run() == FALSE)
			{
				$this->load->view('/attached/feedback');
			} else {
				$this->Suggest_model->add($data);
				$this->load->view('/attached/feedback', array('feedback' => 1));
			}
			
		} else {
			$this->load->view('/attached/feedback');
		}
	}
}